<!DOCTYPE html>
<html>

	<head>
		<title>我的消息</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
			<script src="/js/jquery/jquery.min.js"></script>
			<script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
			<link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
			<link rel="stylesheet" href="/css/reset.css"/>
			<link rel="stylesheet" href="/css/message.css" />
			<script src="/js/plugins/jrender/jrender.min.js"></script>
			<link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
			<script src="/js/plugins/dialog2/dialog.min.js"></script>

		<script type="text/javascript">
            var user;
            function runEvery10Sec() {
                //setTimeout( runEvery10Sec, 1000*10);
                user = JSON.parse(sessionStorage.getItem('user'));
                //发送请求,计算未读信息的数量
                $.get("/messages/"+user.id+"/"+0+"/counts",function (data) {
                    $.each(data,function (index, ele) {
                        //console.log(ele.systemMeCount);

                        //系统消息
                        if(ele.systemMeCount>0){
                            $("#systemMessage").html(ele.systemMeCount);
                        }


                        console.log(ele.privateMeCount);
                        //私信
                        if(ele.privateMeCount>0){
                            $("#privateMeCount").html(ele.privateMeCount);

                        }

                    });
                });

            }
            runEvery10Sec();
		</script>
	</head>

	<body>
		<div class="search-head">
			<div class="row nav-search">
				<div class="col">
					<a href="/mine/profiles.html">
						<span><i class="fa fa-chevron-left" ></i></span>
					</a>
				</div>
				<div class="col">
					<span>我的消息</span>
				</div>
				<div class="col"></div>
			</div>
		</div>

		<ul class="list-group">
			<a href="/mine/messagePraise.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i class="fa fa-thumbs-o-up" ></i></span>
						<span>赞</span>
						<span class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>

			<a href="/mine/messageComment.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i class="fa fa-commenting-o" ></i>	</span>
						<span>评论</span>
						<span class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="/mine/messageLetter.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i class="fa fa-envelope-o" ></i></span>
						<span>	私信</span>
						<span class="badge badge-danger badge-pill" id="privateMeCount"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="/mine/messageSystem.html?type=4" id="system">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i class="fa fa-bell" ></i></span>
						<span >系统通知</span>
						<span id="systemMessage" class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
		</ul>
	</body>

</html>